<?php 
class users_Form_FrmUserType extends Zend_Form
{
	public function frmTypeUser($frm = null)
    {
    	//user name    	
    	$user_type=new Zend_Form_Element_Text('user_type');
    	$user_type->setAttribs(array(
    		'id'=>'user_type',
    		'class'=>'form-control validate[required]',
    		'Onkeyup'=>'getfillterUserType()'
    	));
    	$this->addElement($user_type);    	
    	//Main parent of user type
		$db=new Application_Model_DbTable_DbGlobal();
		$rs=$db->getGlobalDb('SELECT user_type_id,user_type FROM tbwu_acl_user_type where user_type_id');
		$options=array(''=>'--- ជ្រើសរើសប្រភេទអ្នកប្រើប្រាស់ ---');
		foreach($rs as $read) $options[$read['user_type_id']]=$read['user_type'];
		$user_type_id=new Zend_Form_Element_Select('parent_id');		
    	$user_type_id->setMultiOptions($options);
    	$user_type_id->setAttribs(array(
    		'id'=>'parent_id',
    		'class'=>'form-control chzn-select validate[required]',
    	));
    	$this->addElement($user_type_id);
    	$id = new Zend_Form_Element_Hidden('id');
    	$this->addElement($id);
    	if($frm !=""){
    		$id->setValue($frm['user_type_id']);
    		$user_type_id->setValue($frm['parent_id']);
    		$user_type->setValue($frm['user_type']);
    	}
    	return $this;
    }
}
?>